﻿<%@ Page    Title="查询：航次信息" 
            Language="C#" 
            MasterPageFile="~/DefaultMaster.master" 
            AutoEventWireup="true" 
            CodeBehind="Default.aspx.cs" 
            Inherits="QueryCommon.Default" 
            Theme="DefaultSiteTheme"%>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit"%>
<%@ Register TagPrefix="CQ" TagName="UCPage" Src="./UCS/UCPage.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="SampleContent" runat="server">
    <div class="help">
        <asp:UpdatePanel ID="UPHelp" runat="server">
            <ContentTemplate>
                <asp:Panel ID="PanelHelpHead" runat="server" CssClass="collapsePanelHeader" Height="30px"> 
                    <div style="padding:5px; cursor: pointer; vertical-align: middle;">
                        <div style="float: left;">通过查询能获得哪些信息?</div>
                        <div style="float: left; margin-left: 20px;">
                            <asp:Label ID="LabelHelpHead" runat="server">(显示详细内容...)</asp:Label>
                        </div>
                        <div style="float: right; vertical-align: middle;">
                            <asp:ImageButton ID="ImageHelpHead" runat="server" ImageUrl="~/images/expand_blue.jpg" AlternateText="(显示详细内容...)"/>
                        </div>
                    </div>
                </asp:Panel>
                <asp:Panel ID="PanelHelpMain" runat="server" CssClass="collapsePanel" Height="0">
                    <div style="padding:5px; cursor: pointer; vertical-align: middle;">
                        <br />
                        <p>
                            本查询显示了当日所有的航次的基本信息。
                        </p>
                        <br />
                        <p>
                            通过查询可以了解到当日航次的开航、售票的状态以及余票的信息。
                        </p>
                        <br />
                    </div>
                </asp:Panel>
                <ajaxToolkit:CollapsiblePanelExtender ID="cpeHelp" runat="Server"
                    TargetControlID="PanelHelpMain"
                    ExpandControlID="PanelHelpHead"
                    CollapseControlID="PanelHelpHead" 
                    Collapsed="True"
                    TextLabelID="LabelHelpHead"
                    ImageControlID="ImageHelpHead"    
                    ExpandedText="(隐藏详细内容...)"
                    CollapsedText="(显示详细内容...)"
                    ExpandedImage="~/images/collapse_blue.jpg"
                    CollapsedImage="~/images/expand_blue.jpg"
                    SkinID="CollapsiblePanelDemo" />
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    <input id="btnTest" type="button" value="查询" onclick="return getResultArray(9999)" />
    <hr/>
    <CQ:UCPage ID="ucpage1" runat="server"/>
    <hr />
    <div id="divShowResult">
    </div>

    <script language="javascript" type="text/javascript">
        function getResultArray(pageNum) {
            //点击查询显示指定页的记录并判断是否首次访问以实现随机行间变换颜色的效果
            if (pageNum == 9999) {
                pageNum = $get(globals.controlIdentities.tbxNo).value;
                globals.controlIdentities.IsFirst = true;
            }
            else {
                globals.controlIdentities.IsFirst = false;
            }
            var service = new QueryCommon.QueryWCF();
            service.GetVoyageCommon(pageNum, getResultArraySuccess, null, null);
        }

        function getResultArraySuccess(result) {
            var message = new Array();
            //设置列宽
            message[0] = new Array();
            message[0][0] = 150;
            message[0][1] = 100;
            message[0][2] = 100;
            message[0][3] = 60;
            message[0][4] = 60;
            message[0][5] = 60;
            //设置列名
            message[1] = new Array();
            message[1][0] = "航线";
            message[1][1] = "船舶";
            message[1][2] = "开航时间";
            message[1][3] = "开航";
            message[1][4] = "开售";
            message[1][5] = "余票";
            var i = 2;
            for (var item in result) {
                message[i] = new Array();
                message[i][0] = result[item].CName;
                message[i][1] = result[item].YName;
                message[i][2] = result[item].Leave;
                message[i][3] = result[item].Sail == true ? "是" : "否";
                message[i][4] = result[item].Sell == true ? "是" : "否";
                message[i][5] = result[item].Rest == true ? "有" : "无";
                i++;
            }
            //通过全局变量的方式设置页数显示
            $get(globals.controlIdentities.tbxPageNum).value = result.toString().length == 0 ? "" : result[0].PageNumber;

            ShowArray(message);
        }
    </script>
</asp:Content>
